<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>表单提交事件</title>
    <script>
      function check() {
        alert("表单提交事件触发");
        return true;
      }
    </script>
</head>
<body>
    <form action="https://www.baidu.com" onsubmit="return check()">
      用户名：<input type="text" name="user" placeholder="用户名"><br>
      密码：&nbsp;&nbsp;&nbsp;<input type="password" name="password" placeholder="密码"><br>
      <input type="submit" value="表单提交">
    </form>
</body>
</html>